package cn.com.cym.gamezao.web.grk;

import cn.com.cym.gamezao.annotation.AuthToken;
import cn.com.cym.gamezao.base.BaseController;
import cn.com.cym.gamezao.base.BaseService;
import cn.com.cym.gamezao.entity.grk.Patient;
import cn.com.cym.gamezao.entity.xmu.recruit.ApplyLog;
import cn.com.cym.gamezao.service.grk.PatientService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "grk-患者信息")
@RestController
@AllArgsConstructor
@RequestMapping(value = "grk/patient")
@AuthToken(rule = "grk.patient")
public class PatientController extends BaseController<Patient> {

    final PatientService thisService;

    @Override
    public BaseService<Patient> getService() {
        return thisService;
    }

    @ApiImplicitParam(name = "patient", value = "patient", required = true,dataType = "Patient")
    @ApiOperation(value = "保存患者")
    @ApiOperationSupport(order = 1, author = "mr.chen")
    @PostMapping("")
    @AuthToken(rule = "save",require = false)
    public ResponseEntity<?> save(@RequestBody Patient patient) {
        Patient save = this.thisService.save(patient);
        return ResponseEntity.ok(save);
    }
}
